<template>
  <div>
    <div class="product-item">
      <div class="product-img">
        <!--图片-->
        <router-link :to="{path: '/detail', query: {goodsId: product.id}}" target="_blank">
          <img v-lazy="product.icon1" :alt="product.goods_name" :title="product.goods_name" imgtype='commodity'/>
        </router-link>
      </div>
      <p class="product-title">
        <router-link :to="{path: '/detail', query: {goodsId: product.id}}" target="_blank">{{ product.goods_name }} {{ product.type_name }} {{ product.sx_name }}</router-link>
      </p>
      <!--价格-->
      <template v-if="product.base_price > 200">
        <p class="product-total-price">{{$t('message.currencySymbol')}}{{ product.base_price }}</p>
        <p class="product-installment">{{$t('message.currencySymbol')}}<span class="product-installment-price">{{ product.staging_price }}</span>X {{product.stages}}{{$t('message.time')}}</p>
      </template>
      <template v-else>
        <p class="product-total-price"></p>
        <p class="product-installment">{{$t('message.currencySymbol')}}<span class="product-installment-price">{{ product.base_price }}</span></p>
      </template>
    </div>
  </div>
</template>

<script>
  export default {
    name: 'VProductItem',
    props: {
      product: {
        type: Object,
        require: true
      }
    }
  }
</script>

<style scoped>
  .product-item {
  }

  .product-img {
    width: 138px;
    height: 138px;
    margin: 0 auto;
  }

  .product-img img {
    width: 100%;
    height: 100%;
  }

  .product-title {
    height: 40px;
    font-size: 14px;
    color: #333;
    line-height: 20px;
    margin-top: 16px;
    text-overflow: ellipsis;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }

  .product-title a {
    color: #333;
    font-size: 14px;
  }

  .product-title a:hover {
    color: #FF600A;
    text-decoration: underline;
  }

  .product-total-price {
    height: 20px;
    line-height: 20px;
    font-size: 14px;
    color: #676767;
    text-decoration: line-through;
    margin-top: 8px;
  }

  .product-installment {
    height: 17px;
    line-height: 17px;
    font-size: 12px;
    color: #ff600a;
    margin-top: 14px;
  }

  .product-installment-price {
    font-size: 18px;
    padding: 0 8px 0 2px;
  }
</style>
